<template>
  <div class="myTable">
    <slot name="xxx"> </slot>
    <el-table
      height="395"
      ref="customTable"
      :data="tableData"
      style="width: 100%; margin-bottom: 20px"
      :row-key="rowKey"
      :border="border"
      :header-cell-style="headerStyle"
      :cell-style="cellStyle"
      :stripe="stripe"
    >
      <el-table-column align="center" type="selection" width="55">
      </el-table-column>
      <el-table-column
        v-for="item in column"
        :key="item.code"
        :prop="item.code"
        :label="item.label"
        :width="item.width"
        :align="item.align"
      >
        <template slot-scope="scope">
          <slot :name="item.code" :data="scope.row">
            <span>{{ scope.row[item.code] }}</span>
          </slot>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "myTable",
  data() {
    return {};
  },
  activated() {
    this.$refs.customTable.doLayout();
  },
  props: {
    headBtn: {},
    headerStyle: {
      type: Object,
      default: () => {
        return {};
      },
    },
    cellStyle: {
      type: Object,
      default: () => {
        return {};
      },
    },
    column: {
      type: Array,
      default: () => {
        return [];
      },
    },
    border: {
      type: Boolean,
      default: () => {
        return false;
      },
    },
    tableData: {
      type: Array,
      default: () => {
        return [];
      },
    },
    rowKey: {
      type: String,
      default: () => {
        return "id";
      },
    },
    stripe: {
      type: Boolean,
      default: () => {
        return true;
      },
    },
  },
  methods: {
    deleteRow(index, rows) {
      rows.splice(index, 1);
    },
  },
};
</script>

<style lang="less" scoped>
.myTable {
  user-select: none;
  :deep(.is-scrolling-none) {
    overflow: hidden;
    overflow-y: auto;
    overflow-x: scroll;
  }
  :deep(.is-scrolling-none::-webkit-scrollbar) {
    display: none;
  }
  :deep(.el-table--scrollable-y ::-webkit-scrollbar) {
    display: none;
  }
  :deep(.el-table--scrollable-x ::-webkit-scrollbar) {
    display: none;
  }
}
.myTable :deep(.el-table--scrollable-y .el-table__body-wrapper) {
  overflow: hidden;
}
.myTable :deep(.el-table .el-table__fixed-right-patch) {
  width: 0px !important;
}
.myTable
  :deep(.el-table--scrollable-y .el-table__body-wrapper::-webkit-scrollbar) {
  width: 0;
}
.myTable :deep(.el-table__expand-icon) {
  -webkit-transform: rotate(0deg);
  transform: rotate(0deg);
}

:deep(.el-table__body-wrapper::-webkit-scrollbar) {
  width: 0px;
  border: none;
}
:deep(.el-table__body-wrapper::-webkit-scrollbar-track) {
  border: none;
}
.myTable :deep(.el-table th.gutter) {
  display: none;
  width: 0;
}
.myTable :deep(.el-table__body) {
  width: 100% !important;
}
.myTable :deep(.el-table colgroup col[name="gutter"]) {
  display: none;
  width: 0;
}
.myTable :deep(.el-table__expand-icon .el-icon-arrow-right:before) {
  content: "\e723";
  color: #000;
  font-size: 18px;
  position: relative;
  top: 1px;
}

.myTable :deep(.el-table__expand-icon--expanded .el-icon-arrow-right:before) {
  content: "\e722";
  color: #000;
}

.myTable :deep(.el-button--mini),
:deep(.el-button--mini.is-round) {
  padding: 5px 10px;
}
.myTable :deep(.el-table .el-table__cell) {
  padding: 5px 0;
}
</style>
